#ifndef _CAN_DRV_H__
#define _CAN_DRV_H__
#include <stdio.h>
#include "os/types.h"

enum can_bitrate {
    CAN_BITRATE_10K = 0,
    CAN_BITRATE_20K,
    CAN_BITRATE_50K,
    CAN_BITRATE_100K,
    CAN_BITRATE_125K,
    CAN_BITRATE_250K,
    CAN_BITRATE_500K,
    CAN_BITRATE_750K,
    CAN_BITRATE_1000K,
	CAN_BITRATE_83_3K,

	CAN_BITRATE_INVALID,
};

#define CAN_BITRATE   CAN_BITRATE_250K

typedef void (*can_frame_handler)(u32 id, u8 *data, int len);

#define CAN_FILTER_DEST_MASK 0x7F

int can_send_message(uint32_t can_id, const void*buff, int len);
int can_send_ext_message(uint32_t can_id, const void*buff, int len);
void can_drv_init(can_frame_handler handler);
void can_drv_reset(void);
void can_drv_deinit(void);
void can_rx_poll(void);

#endif /* _CAN_DRV_H__ */

